import { View } from "../../../mvc/core/View";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { PageTool } from "../../../common/global/PageTool";
import { MsgManager } from "../../manager/MsgManager";
import { Language } from "../../../../extend/language/Language";
import { ItemData } from "../../resource/info/ItemData";
import { WardrobeConfig } from "../../resource/WardrobeConfig";
import { FashionBoxUtil } from "./FashionBoxUtil";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { FashionJewelItem } from "./fashionJewel/FashionJewelItem";
import { ListEvent } from "../../../../fl/events/ListEvent";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { GImageButtonTabBar } from "../../../../com/mui/controls/GImageButtonTabBar";
import { GBoxDirection } from "../../../../com/mui/containers/globalVariable/GBoxDirection";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GImageBitmap } from "../../../../com/mui/controls/GImageBitmap";
import { FashionJewelTargetBtn } from "./fashionJewel/FashionJewelTargetBtn";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { FashionJewelCenterItem } from "./fashionJewel/FashionJewelCenterItem";
import { FashionJewelAttriPart } from "./fashionJewel/FashionJewelAttriPart";
import { FlowerBg } from "../common/FlowerBg";
import { GTabBar } from "../../../../com/mui/controls/GTabBar";
import { MuiEvent } from "../../../../com/mui/events/MuiEvent";
import { TilePanel } from "../equipment/TilePanel";
import { MountItemCellRenderer } from "../mounts/mount/MountItemCellRenderer";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { MountFeeCostCellRenderer } from "../mounts/mount/MountFeeCostCellRenderer";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { SelectNumWindow } from "../common/SelectNumWindow";
import { Cache } from "../../cache/Cache";
import { ECategory } from "../../../../Message/Public/ECategory";
import { ToolTipInfo } from "../../model/ToolTipInfo";
import { NormalTooltip } from "../common/tooltip/NormalTooltip";
import { FashionJewelEquipToolTipsPart } from "./fashionJewel/FashionJewelEquipToolTipsPart";
import { FashionJewelAttriItemToolTips } from "./fashionJewel/FashionJewelAttriItemToolTips";
import { FashionJewelTargetTips } from "./fashionJewel/FashionJewelTargetTips";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { EquipmentModuleConst } from "../equipment/data/EquipmentModuleConst";
import { GButton } from "../../../../com/mui/controls/GButton";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { _curFashionType } from "../../../../this/_curFashionType";
import { _curJewelType } from "../../../../this/_curJewelType";
import { EquipmentType_All } from "../../../../EquipmentModuleConst/EquipmentType_All";
type int = number;
//class FashionJewelPanel
    
    export  class FashionJewelPanel extends View
    {
        constructor()
        {
            this.rtnArray = [];
            this._itemsDataProvider = new DataProvider();
            this._pageToolUp = new PageTool([], this._UpPageSize);
            this._allItem = [];
            this.posData = [{"x": 27, "y": 174, "index": 1}, {"x": 43, "y": 92, "index": 2}, {"x": 118, "y": 34, "index": 3}, {"x": 215, "y": 34, "index": 4}, {"x": 287, "y": 92, "index": 5}, {"x": 304, "y": 174, "index": 6}];
            this._itemFeedArr = [];
            this._costItemArr = [];
            super();
            this.init();
            return;
        }

        /* internal  */onReadMemoryBtn(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc3=null;
            var loc4=null;
            var loc5=false;
            var loc7=0;
            if (this._costItemArr.length >= this._downPageSize) 
            {
                MsgManager.showRollTipsMsg(Language.getString(74617));
                return;
            }
            var loc1=this._itemFeedArr.length;
            var loc2=this._costItemArr.length;
            var loc6=0;
            while (loc6 < loc1) 
            {
                loc3 = this._itemFeedArr[loc6];
                loc7 = 0;
                while (loc7 < loc2) 
                {
                    loc4 = this._costItemArr[loc7]["itemData"] as ItemData;
                    if (loc3.uid == loc4.uid) 
                    {
                        loc5 = true;
                        break;
                    }
                    ++loc7;
                }
                if (!loc5) 
                {
                    this._costItemArr.push({"itemData": loc3, "num": loc3.itemAmount});
                    this._expFeedTotal = this._expFeedTotal + WardrobeConfig.instance.getfashionJewelValueDic(loc3.itemCode) * loc3.itemAmount;
                    this._txExp.text = this._expFeedTotal.toString();
                    this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
                    this.onUpPageSelecter(null);
                    if (loc2 >= this._downPageSize) 
                    {
                        break;
                    }
                }
                ++loc6;
            }
            return;
        }

        /* internal  */curFashionType(arg1: int): void
        {
            this._curFashionType = FashionBoxUtil.getFashionType(arg1);
            return;
        }

        /* internal  */tabBarChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target.selectedIndex;
            this.curFashionType(loc1);
            this.updateInfo();
            return;
        }

        /* internal  */updateCenterItem(arg1: Boolean, arg2: int): void
        {
            if (arg1) 
            {
                this._centerBItem.picData = GlobalClass.getBitmapData("fashionJewelTypeLogo_" + arg2);
            }
            return;
        }

        /* internal  */onLoadBmResource(): void
        {
            this._load = true;
            this._bmUp.bitmapData = GlobalClass.getBitmapData(ImagesConst.fashionJewl_goods);
            this._bmGetExp.bitmapData = GlobalClass.getBitmapData(ImagesConst.fashionJewl_get);
            this._bmUpgrade.bitmapData = GlobalClass.getBitmapData(ImagesConst.fashionJewl_lvCost);
            this.updateCenterItem(this._load, this._curFashionType);
            return;
        }

        /* internal  */onItemClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.currentTarget as FashionJewelItem;
            if (loc1.attri == this._curJewelType) 
            {
                return;
            }
            loc1.selected = true;
            this._formerItem.selected = false;
            if (this._formerItem.attri != loc1.attri) 
            {
                this.clearCostList();
            }
            this._formerItem = loc1;
            this._curJewelType = this._formerItem.attri;
            this._curJewelLv = this._formerItem.lv;
            this.updateByAttri();
            return;
        }

        /* internal  */onCostItemClickHander(arg1: ListEvent): void
        {
            var loc5=0;
            var loc6=null;
            var loc1=arg1.item;
            var loc2=loc1["itemData"] as ItemData;
            var loc3=loc1["num"] as int;
            var loc4;
            if ((loc4 = this._costItemArr.length) > 0) 
            {
                loc5 = 0;
                while (loc5 < loc4) 
                {
                    loc6 = this._costItemArr[loc5]["itemData"] as ItemData;
                    if (loc2.uid == loc6.uid) 
                    {
                        this._expFeedTotal = this._expFeedTotal - WardrobeConfig.instance.getfashionJewelValueDic(loc2.itemCode) * loc3;
                        this._txExp.text = this._expFeedTotal.toString();
                        this._costItemArr.splice(loc5, 1);
                    }
                    ++loc5;
                }
            }
            this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
            this.onUpPageSelecter(null);
            return;
        }

        /* internal  */onFeedClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=0;
            var loc4=null;
            var loc5=0;
            if (arg1.target.name != "_feedBtn") 
            {
                if (arg1.target.name == "fashionJewelUpgradeBtn") 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FashionJewelGoUpgrade, {"fashionType": _curFashionType, "jewelType": _curJewelType}));
                }
            }
            else 
            {
                loc3 = this._costItemArr.length;
                loc4 = new Map<any, any> /* flash.utils.Dictionary */();
                if (loc3 > 0) 
                {
                    loc5 = 0;
                    while (loc5 < loc3) 
                    {
                        loc1 = this._costItemArr[loc5]["itemData"] as ItemData;
                        loc2 = this._costItemArr[loc5]["num"] as int;
                        loc4[loc1.uid] = loc2;
                        ++loc5;
                    }
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FashionJewelGoFeed, {"dic": loc4, "jewelType": _curJewelType}));
                }
            }
            return;
        }

        /* internal  */updateItemList(arg1: Array<any>): void
        {
            var loc4=null;
            var loc7=null;
            var loc8=0;
            this._itemsDataProvider.removeAll();
            var loc1=arg1.length;
            var loc2=this._costItemArr.length;
            var loc3=0;
            while (loc3 < loc1) 
            {
                arg1[loc3].mountEffect = "";
                ++loc3;
            }
            var loc5=0;
            while (loc5 < loc2) 
            {
                loc4 = this._costItemArr[loc5]["itemData"] as ItemData;
                loc8 = 0;
                while (loc8 < loc1) 
                {
                    loc7 = arg1[loc8] as ItemData;
                    if (loc4.uid == loc7.uid) 
                    {
                        loc7.mountEffect = loc7.uid;
                        break;
                    }
                    ++loc8;
                }
                ++loc5;
            }
            var loc6=0;
            while (loc6 < loc1) 
            {
                this._itemsDataProvider.addItem(arg1[loc6]);
                ++loc6;
            }
            this._itemsList.dataProvider = this._itemsDataProvider;
            return;
        }

        /* internal  */init(): void
        {
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc8=null;
            var loc9=0;
            var loc10=null;
            var loc11=0;
            this._tabPicBar = new GImageButtonTabBar();
            this._tabPicBar.buttonHeight = 48;
            this._tabPicBar.buttonWidth = 77;
            this._tabPicBar.x = 3;
            this._tabPicBar.y = 2;
            this._tabPicBar.verticalGap = 2;
            this._tabPicBar.direction = GBoxDirection.VERTICAL;
            this._tabPicBar.buttonFilters = [FilterConst.glowFilter];
            this.addChild(this._tabPicBar);
            this._centerSp = new Object /* flash.display.Sprite */();
            this._centerSp.x = 79;
            this._centerSp.y = 1;
            addChild(this._centerSp);
            this._bg = new GImageBitmap(ImagesConst.fashionJewelBg, 0, 0);
            this._centerSp.addChild(this._bg);
            this._targetBtn = new FashionJewelTargetBtn();
            this._targetBtn.x = 24;
            this._targetBtn.y = 11;
            this._centerSp.addChild(this._targetBtn);
            var loc1=ObjCreate.createBg(284, 3, 84, 45, this._centerSp, ImagesConst.FightingStrgBg);
            var loc2=new GTextFormat(FontUtil.songtiName, 15, GlobalStyle.dYellowUint, true);
            loc3 = new GTextFormat(FontUtil.EmbedNumberName, 16, GlobalStyle.greenUint);
            this._costExpNameTx = ObjCreate.createTextField("穿刺精華保濕", 273, 6, 102, 30, this._centerSp, loc2);
            this._costExpNameTx.autoSize = flash.text.TextFieldAutoSize.RIGHT;
            this._costExpTx = ObjCreate.createTextField("1234568", 273, 24, 102, 30, this._centerSp, loc3);
            this._costExpTx.autoSize = flash.text.TextFieldAutoSize.CENTER;
            var loc6=0;
            while (loc6 < this.posData.length) 
            {
                loc5 = this.posData[loc6];
                (loc4 = new FashionJewelItem()).buttonMode = true;
                loc4.useHandCursor = true;
                loc4.x = loc5["x"];
                loc4.y = loc5["y"];
                loc4.mouseEnabled = true;
                loc4.addEventListener(flash.events.MouseEvent.CLICK, this.onItemClick);
                this._centerSp.addChild(loc4);
                this._allItem.push(loc4);
                ++loc6;
            }
            (this._allItem[0] as FashionJewelItem).selected = true;
            this._formerItem = this._allItem[0] as FashionJewelItem;
            this._itemBg = ObjCreate.createBg(164, 118, 65, 65, this._centerSp, ImagesConst.PackItemBg);
            this._centerBItem = new FashionJewelCenterItem();
            this._centerBItem.x = 167;
            this._centerBItem.y = 120;
            this._centerSp.addChild(this._centerBItem);
            this._bmUpgrade = ObjCreate.createBitmap("", 156, 215, this._centerSp);
            this._progressTx = ObjCreate.createGTextField("123123 / 123123", 114, 239, 149, 20, this._centerSp);
            this._progressTx.autoSize = flash.text.TextFormatAlign.CENTER;
            this._attLeft = new FashionJewelAttriPart(173, 87, 1);
            this._attRight = new FashionJewelAttriPart(173, 87, 2);
            ObjCreate.setObjAttri(this._attLeft, 12, 265, -1, -1, this._centerSp);
            ObjCreate.setObjAttri(this._attRight, 196, 265, -1, -1, this._centerSp);
            this._upgradeBtn = ObjCreate.createGButton(Language.getString(74609), 156, 362, 72, 25, this._centerSp, "ButtonRedMini");
            this._upgradeBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onFeedClickHandler);
            this._upgradeBtn.name = "fashionJewelUpgradeBtn";
            var loc7=ObjCreate.createGTextField(Language.getString(74604), 120, 392, 155, 20, this._centerSp, GlobalStyle.textFormat6);
            this._desTx = ObjCreate.createGTextField("", 286, 368, 66, 20, this._centerSp, GlobalStyle.textFormat5);
            this._desTx.htmlText = Language.getString(71127);
            this._desTx.toolTipData = Language.getString(74616);
            this._spEquipUp = new FlowerBg(233, 192);
            this._spEquipUp.x = 459;
            this._spEquipUp.y = 20;
            addChild(this._spEquipUp);
            this._tabBarUp = new GTabBar();
            this._tabBarUp.x = 460;
            this._tabBarUp.buttonHeight = 20;
            this._tabBarUp.buttonWidth = 38;
            this._tabBarUp.buttonFilters = [FilterConst.glowFilter];
            this._tabBarUp.dataProvider = this._tabBarArr;
            this._tabBarUp.addEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.onTabBarChange);
            addChild(this._tabBarUp);
            this._bmUp = ObjCreate.createBitmap("", 506, 3, this);
            loc9 = 0;
            while (loc9 < this._UpPageSize) 
            {
                (loc8 = GlobalClass.getBitmap(ImagesConst.PackItemBg)).width = 38;
                loc8.height = 38;
                this._spEquipUp.addChild(loc8);
                loc8.x = 11 + loc9 % 5 * 43;
                loc8.y = 3 + Math.floor(loc9 / 5) * 41;
                ++loc9;
            }
            this._itemsList = new TilePanel();
            this._itemsList.columnWidth = 40;
            this._itemsList.rowHeight = 40;
            this._itemsList.setSize(208, 163);
            this._itemsList.setStyle("cellRenderer", MountItemCellRenderer);
            this._itemsList.move(9, 1);
            this._itemsList.addEventListener(ListEvent.ITEM_CLICK, this.onItemClickHandler);
            this._itemsList.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, this.onItemDbClickHandler);
            this._spEquipUp.addChild(this._itemsList);
            this._pageSelectedBarUp = new PageSelecter();
            this._pageSelectedBarUp.mode = PageSelecter.CompleteMode;
            this._pageSelectedBarUp.move(56, 168);
            this._pageSelectedBarUp.addEventListener(flash.events.Event.CHANGE, this.onUpPageSelecter);
            this._spEquipUp.addChild(this._pageSelectedBarUp);
            this._spEquipDown = new FlowerBg(233, 167);
            this._spEquipDown.x = 459;
            this._spEquipDown.y = 243;
            addChild(this._spEquipDown);
            this._bmGetExp = ObjCreate.createBitmap("", 506, 227, this);
            this._txExp = ObjCreate.createGTextField("", 602, 223, 80, 30, this, loc3);
            this._tabBarDown = new GTabBar();
            this._tabBarDown.x = 460;
            this._tabBarDown.y = 222;
            this._tabBarDown.buttonHeight = 20;
            this._tabBarDown.buttonWidth = 38;
            this._tabBarDown.buttonFilters = [FilterConst.glowFilter];
            this._tabBarDown.dataProvider = this._tabBarArr;
            addChild(this._tabBarDown);
            loc11 = 0;
            while (loc11 < this._downPageSize) 
            {
                (loc10 = GlobalClass.getBitmap(ImagesConst.PackItemBg)).width = 38;
                loc10.height = 38;
                this._spEquipDown.addChild(loc10);
                loc10.x = 11 + loc11 % 5 * 43;
                loc10.y = 7 + Math.floor(loc11 / 5) * 41;
                ++loc11;
            }
            this._costItemsList = new TilePanel();
            this._costItemsList.scrollPolicy = ScrollPolicy.OFF;
            this._costItemsList.columnWidth = 40;
            this._costItemsList.rowHeight = 40;
            this._costItemsList.setSize(208, 121);
            this._costItemsList.setStyle("cellRenderer", MountFeeCostCellRenderer);
            this._costItemsList.addEventListener(ListEvent.ITEM_CLICK, this.onCostItemClickHander);
            this._costItemsList.move(9, 4);
            this._spEquipDown.addChild(this._costItemsList);
            this._feedBtn = ObjCreate.createGButton(Language.getString(74608), 117, 134, 70, 25, this._spEquipDown, "ButtonRedMini");
            this._feedBtn.name = "_feedBtn";
            this._feedBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onFeedClickHandler);
            this._readMemoryBtn = ObjCreate.createGButton(Language.getString(27659), 42, 134, 70, 25, this._spEquipDown, "ButtonRedMini");
            this._readMemoryBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onReadMemoryBtn);
            LoaderHelp.addResCallBack(ResFileConst.fashionJewel, this.onLoadBmResource);
            this.refreshTabData();
            this._tabPicBar.selectedIndex = 0;
            this.curFashionType(0);
            this._tabPicBar.addEventListener(MuiEvent.GTABBAR_SELECTED_CHANGE, this.tabBarChangeHandler);
            return;
        }

        public clearCostList(): void
        {
            this._costItemArr = [];
            this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
            this._expFeedTotal = 0;
            this._txExp.text = this._expFeedTotal.toString();
            this.onUpPageSelecter(null);
            return;
        }

        /* internal  */isInCostItemsDataProvider(arg1: ItemData): Boolean
        {
            var loc1=null;
            var loc2=this._costItemArr.length;
            var loc3=0;
            while (loc3 < loc2) 
            {
                loc1 = this._costItemArr[loc3]["itemData"] as ItemData;
                if (loc1.uid == arg1.uid) 
                {
                    return true;
                }
                ++loc3;
            }
            return false;
        }

        /* internal  */onSelectNumOkHandler(arg1: ItemData, arg2: int): void
        {
            var loc1={"itemData": arg1, "num": arg2};
            this._costItemArr.push(loc1);
            this._expFeedTotal = this._expFeedTotal + WardrobeConfig.instance.getfashionJewelValueDic(arg1.itemCode) * arg2;
            this._txExp.text = this._expFeedTotal.toString();
            this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
            this.onUpPageSelecter(null);
            return;
        }

        /* internal  */realItemClickHandler(arg1: ItemData): void
        {
            var loc1=null;
            var loc2=null;
            if (arg1 && this.isInCostItemsDataProvider(arg1) == false) 
            {
                if (arg1.itemAmount > 1) 
                {
                    if (this._selectNumWindow == null) 
                    {
                        this._selectNumWindow = new SelectNumWindow();
                    }
                    this._selectNumWindow.updateByItemData(arg1, this.onSelectNumOkHandler);
                    this._selectNumWindow.show();
                    loc2 = this.localToGlobal(new Object /* flash.geom.Point */(mouseX, mouseY));
                    this._selectNumWindow.x = loc2.x - this._selectNumWindow.btnOK.x;
                    this._selectNumWindow.y = loc2.y - this._selectNumWindow.btnOK.y;
                    return;
                }
                this._expFeedTotal = this._expFeedTotal + WardrobeConfig.instance.getfashionJewelValueDic(arg1.itemCode);
                this._txExp.text = this._expFeedTotal.toString();
                loc1 = {"itemData": arg1, "num": arg1.itemAmount};
                this._costItemArr.push(loc1);
                this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
                this.onUpPageSelecter(null);
            }
            this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
            return;
        }

        /* internal  */dealClick(): void
        {
            var loc1=null;
            if (this.double_b) 
            {
                if (arguments[0] && this.isInCostItemsDataProvider(arguments[0]) == false) 
                {
                    loc1 = {"itemData": arguments[0], "num": arguments[0].itemAmount};
                    this._costItemArr.push(loc1);
                    this._expFeedTotal = this._expFeedTotal + WardrobeConfig.instance.getfashionJewelValueDic(arguments[0].itemCode) * arguments[0].itemAmount;
                    this._txExp.text = this._expFeedTotal.toString();
                }
                this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
                this.onUpPageSelecter(null);
            }
            else 
            {
                this.realItemClickHandler(arguments[0]);
            }
            return;
        }

        /* internal  */onItemDbClickHandler(arg1: ListEvent): void
        {
            if (this._costItemArr.length >= this._downPageSize) 
            {
                return;
            }
            var loc1=arg1.item as ItemData;
            this.double_b = true;
            return;
        }

        /* internal  */onItemClickHandler(arg1: ListEvent): void
        {
            if (this._costItemArr.length >= this._downPageSize) 
            {
                return;
            }
            var loc1=arg1.item as ItemData;
            this.double_b = false;
            flash.utils.setTimeout(this.dealClick, 260, loc1);
            return;
        }

        /* internal  */updateCostItem(arg1: Array<any>): void
        {
            var loc2=false;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=0;
            var loc7=null;
            var loc8=null;
            var loc9=0;
            var loc10=0;
            var loc11=0;
            if (arg1.length == 0) 
            {
                this._costItemArr = [];
                this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
                this.onUpPageSelecter(null);
                return;
            }
            var loc1=[];
            if (arg1.length > 0 && this._costItemArr.length > 0) 
            {
                loc5 = 0;
                while (loc5 < this._costItemArr.length) 
                {
                    loc2 = false;
                    loc3 = this._costItemArr[loc5] as Object;
                    loc6 = 0;
                    while (loc6 < arg1.length) 
                    {
                        loc4 = arg1[loc6];
                        if (loc3["itemData"].uid == loc4.uid && loc3["num"] <= loc4.itemAmount) 
                        {
                            loc2 = true;
                            break;
                        }
                        ++loc6;
                    }
                    if (!loc2) 
                    {
                        loc1.push(loc3);
                    }
                    ++loc5;
                }
                if (loc1.length > 0) 
                {
                    loc10 = 0;
                    while (loc10 < loc1.length) 
                    {
                        loc7 = loc1[loc10]["itemData"] as ItemData;
                        loc11 = 0;
                        while (loc11 < this._costItemArr.length) 
                        {
                            loc8 = this._costItemArr[loc11]["itemData"] as ItemData;
                            loc9 = this._costItemArr[loc11]["num"];
                            if (loc7.uid == loc8.uid) 
                            {
                                this._expFeedTotal = this._expFeedTotal - WardrobeConfig.instance.getfashionJewelValueDic(loc8.itemCode) * loc9;
                                this._txExp.text = this._expFeedTotal.toString();
                                this._costItemArr.splice(loc11, 1);
                                break;
                            }
                            ++loc11;
                        }
                        ++loc10;
                    }
                    this._costItemsList.dataProvider = new DataProvider(this._costItemArr);
                    this.onUpPageSelecter(null);
                }
            }
            return;
        }

        /* internal  */onUpPageSelecter(arg1: Object /* flash.events.Event */): void
        {
            var loc1=this._pageSelectedBarUp.currentPage;
            this.updateItemList(this._pageToolUp.getByPageNo(loc1));
            return;
        }

        /* internal  */updatePackItemRightPart(): void
        {
            this._itemFeedArr = Cache.instance.wardrobe.getFeedJwelItem(ECategory._ECategoryJewel, this._curJewelType);
            this._pageToolUp.array = this._itemFeedArr;
            this._pageSelectedBarUp.maxPage = this._pageToolUp.pagesCount;
            this.onUpPageSelecter(null);
            this.updateCostItem(this._itemFeedArr);
            return;
        }

        /* internal  */updateCenterData(): void
        {
            this.updateCenterItem(this._load, this._curFashionType);
            this._centerBItem.toolTipData = new ToolTipInfo(NormalTooltip.ToolTipRenderType_Sprite, Cache.instance.wardrobe.getSelfFashionJewelInfoArr(Cache.instance.role.entityInfo.career, this._curFashionType), new FashionJewelEquipToolTipsPart());
            this._attLeft.updateInfo(this._curJewelLv, this._curJewelType);
            this._attRight.updateInfo(this._curJewelLv + 1, this._curJewelType);
            return;
        }

        /* internal  */updateByAttri(): void
        {
            this.updateCostExp();
            this.updateCenterData();
            this.updatePackItemRightPart();
            return;
        }

        public updateInfo(): void
        {
            var loc2=null;
            var loc4=0;
            var loc1=[];
            var loc3=WardrobeConfig.instance.getfashionJewelPosDic(this._curFashionType, Cache.instance.role.entityInfo.career);
            var loc5=0;
            while (loc5 < 6) 
            {
                loc4 = loc3[loc5];
                loc2 = this._allItem[loc5] as FashionJewelItem;
                loc2.updateInfo(loc4, Cache.instance.wardrobe.fashionJewelEachAttrLvDic[this._curFashionType + "_" + loc4]);
                loc2.toolTipData = new ToolTipInfo(NormalTooltip.ToolTipRenderType_Sprite, {"attri": loc4, "lv": loc2.lv}, new FashionJewelAttriItemToolTips());
                loc1.push(Cache.instance.wardrobe.fashionJewelEachAttrLvDic[this._curFashionType + "_" + loc4]);
                ++loc5;
            }
            this._targetBtn.toolTipData = new ToolTipInfo(NormalTooltip.ToolTipRenderType_Sprite, loc1, new FashionJewelTargetTips());
            this._curJewelLv = this._formerItem.lv;
            this._curJewelType = this._formerItem.attri;
            this.updateByAttri();
            return;
        }

        public updateCostExp(): void
        {
            var loc1=GameDefConfig.instance.getEJewel(this._curJewelType);
            this._costExpNameTx.text = Language.getStringByParam(74603, loc1.text1);
            this._costExpTx.text = Cache.instance.wardrobe.fashionJewelEachAttrCostDic[this._curJewelType].toString();
            var loc2=WardrobeConfig.instance.getfashionJewelExpDic(this._curJewelLv + 1);
            var loc3=Cache.instance.wardrobe.fashionJewelEachAttrCostDic[this._curJewelType];
            if (loc3 >= loc2) 
            {
                this._progressTx.htmlText = "<font size=\'12\' color=\'#00ff00\'>" + loc3 + " / " + loc2 + "</font>";
            }
            else 
            {
                this._progressTx.htmlText = "<font size=\'12\' color=\'#ff0000\'>" + loc3 + "</font> / <font color=\'#00ff00\'>" + loc2 + "</font>";
            }
            return;
        }

        /* internal  */onTabBarChange(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target.selectedIndex;
            this._pageToolUp.array = Cache.instance.wardrobe.getFeedJwelItem(ECategory._ECategoryJewel, this._curJewelType);
            this._pageSelectedBarUp.maxPage = this._pageToolUp.pagesCount;
            this._pageSelectedBarUp.currentPage = 1;
            this.onUpPageSelecter(null);
            return;
        }

        /* internal  */refreshTabData(): void
        {
            var loc1=null;
            this.rtnArray = [];
            var loc2=0;
            while (loc2 < FashionJewelPanel.EQUITMENTNUM) 
            {
                loc1 = new Map<any, any> /* flash.utils.Dictionary */();
                loc1["name"] = loc2;
                loc1["label"] = loc2;
                loc1["styleName"] = "FashionTab" + loc2;
                this.rtnArray.push(loc1);
                ++loc2;
            }
            this._tabPicBar.dataProvider = this.rtnArray;
            return;
        }

        /* internal */ static /* const */EQUITMENTNUM: int=8;

        /* internal */ /* const */_tabBarArr: Array<any>=[{"name":"", "type": EquipmentType_All, "label": Language.getString(70017)}];

        /* internal */ /* var */_curFashionType: int;

        /* internal */ /* var */_curJewelType: int;

        /* internal */ /* var */_curJewelLv: int;

        /* internal */ /* var */_bg: GImageBitmap;

        /* internal */ /* var */rtnArray: Array<any>;

        /* internal */ /* var */_tabPicBar: GTabBar;

        /* internal */ /* var */_tabBarUp: GTabBar;

        /* internal */ /* var */_tabBarDown: GTabBar;

        /* internal */ /* var */_spEquipUp: FlowerBg;

        /* internal */ /* var */_costItemArr: Array<any>;

        /* internal */ /* var */_selectNumWindow: SelectNumWindow;

        /* internal */ /* var */double_b: Boolean;

        /* internal */ /* var */_expFeedTotal: int;

        /* internal */ /* var */_txExp: Object /* flash.text.TextField */;

        /* internal */ /* var */_readMemoryBtn: GButton;

        /* internal */ /* var */_itemBg: ScaleBitmap;

        /* internal */ /* var */_desTx: GTextFiled;

        /* internal */ /* var */posData: Array<any>;

        /* internal */ /* var */_formerItem: FashionJewelItem;

        /* internal */ /* var */_allItem: Array<any>;

        /* internal */ /* var */_load: Boolean;

        /* internal */ /* var */_costExpTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_costExpNameTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_attRight: FashionJewelAttriPart;

        /* internal */ /* var */_attLeft: FashionJewelAttriPart;

        /* internal */ /* var */_targetBtn: FashionJewelTargetBtn;

        /* internal */ /* var */_centerSp: Object /* flash.display.Sprite */;

        /* internal */ /* var */_progressTx: Object /* flash.text.TextField */;

        /* internal */ /* var */_bmUpgrade: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bmGetExp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bmUp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_upgradeBtn: GButton;

        /* internal */ /* var */_feedBtn: GButton;

        /* internal */ /* var */_centerBItem: FashionJewelCenterItem;

        /* internal */ /* var */_costItemsList: TilePanel;

        /* internal */ /* var */_pageSelectedBarUp: PageSelecter;

        /* internal */ /* var */_pageToolUp: PageTool;

        /* internal */ /* var */_itemsDataProvider: DataProvider;

        /* internal */ /* var */_itemsList: TilePanel;

        /* internal */ /* var */_UpPageSize: int=20;

        /* internal */ /* var */_downPageSize: int=15;

        /* internal */ /* var */_spEquipDown: FlowerBg;

        /* internal */ /* var */_itemFeedArr: Array<any>;
    }
